package main;

import main.nbc.NBC;
import main.svm.svm_predict;
import main.svm.svm_train;
import main.utils.UTILS;

import java.io.IOException;

/**
 * @author LiuXingWu
 * @create 2021-01-22 17:29
 */
public class Main {
    public static void main(String[] args) throws IOException {
        System.out.println("使用支持向量机对乳腺癌分类结果如下：");
        NBC testDemo = new NBC("breast-cancer数据.txt");
        System.out.println("数据总量：" + testDemo.getSrcData().size()
                                   + "，训练数据总量：" + testDemo.getTrainData().size()
                                   + "，测试数据总量：" + testDemo.getTestData().size()
                                   + "\n训练数据中恶性样本数据：" + testDemo.getBCData().size()
                                   + "，训练数据中非恶性样本数据：" + testDemo.getNotBCData().size());
        testDemo.excute();


        System.out.println("\n\n使用支持向量机SVM对乳腺癌分类结果如下（调用LibSVM提供的相关包）：");
        UTILS.SVMDataProcessing(UTILS.readInfoFromFile("breast-cancer数据.txt"));
        String[] trainArgs = {"svm_breast_cancer"};//directory of training file
        String modelFile = svm_train.main(trainArgs);
        String[] testArgs = {"svm_breast_cancer", modelFile, "svm_breast_cancer_result"};
        svm_predict.main(testArgs);
    }
}
